@import "../../assets/iconfont/iconfont";
@import "../styles/button";
@import "../styles/variables";
@import "../styles/placeholders";

$footer-height: 52px;
$confirm-min-height: 168px;
$confirm-icon-margin: 15px;

%border {
	border-radius: 2px;
}

%modal-icon {
	cursor: pointer;
	&:hover {
		color: #A5A5A5;
	}
	&:active {
		color: #A5A5A5;
	}
}

.ccms-modal {
	font-family: $font-family;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: $modal-z-index;

	@extend %absolute-center-flex;

	* {
		box-sizing: border-box;
	}

	.icons {

		color: #cecece;
		display: block;
		text-align: right;

		span {
			margin-left: 8px;
		}

		.set-fullscreen {
			@extend %modal-icon;
			@extend .iconfont;
			@extend .icon-fullscreen;
		}

		.cancel-fullscreen {
			@extend %modal-icon;
			@extend .iconfont;
			@extend .icon-narrow;
			display: none;
		}

		.close-modal {
			@extend %modal-icon;
			@extend .iconfont;
			@extend .icon-close;
			color: #cecece;
		}

	}

	.container {
		display: none;
		z-index: $modal-z-index;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.13);

		> header {

			display: flex;
			justify-content: space-between;
			align-items: center;

			height: 42px;
			@extend %border;

			background: #ededed;
			box-shadow: 0 1px 0 0 #e9e9e9;

			padding: 10px 20px 9px 20px;

			h3 {
				font-size: 14px;
				font-weight: normal;
				color: #666666;
				line-height: 23px;
				display: inline-block;
				margin: 0;
			}

		}

		> footer {
			@extend %border;
			background: #f5f5f5;
			box-shadow: 0px -1px 0 0 #f1f1f1;
			height: $footer-height;
			text-align: right;

			button {
				margin: 11px 0 11px 11px;
			}

			button:last-child {
				margin-right: 19px;
			}
		}

		&.modal {
			min-width: 680px;
			font-size: 12px;

			.modal-body {
				min-height: 326px;
				padding: 20px 20px 0 20px;
				overflow: auto;
				background-color: #f8f8f8;
				position: relative;
			}

			&.fullscreen {
				max-width: none !important;
				max-height: none !important;
				width: 100%;
				height: 100%;

				.modal-body {
					max-width: none !important;
					max-height: none !important;
					width: 100%;
					height: calc(100% - 94px);
				}

				.set-fullscreen {
					display: none;
				}

				.cancel-fullscreen {
					display: inline;
				}
			}

		}

		&.confirm {
			width: 450px;
			@extend %border;
			background: #f8f8f8;
			box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.13);

			article {
				min-height: $confirm-min-height - $footer-height;

				.icons {
					padding: $confirm-icon-margin $confirm-icon-margin 0;
				}

				p {
					font-size: 14px;
					color: #666666;
					line-height: 24px;
					text-align: left;
					margin: 0;
					padding: 0 64px 30px 30px;
				}

			}
			footer {
				button:last-child {
					margin-right: 14px;
				}
			}
		}

	}

	.mask {
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		z-index: $mask-z-index;

		background: rgba(102, 102, 102, 0.55);
		opacity: 0;
		transition: opacity .5s linear;
	}

	&.modal-opened {

		.container {
			display: block;
		}

		.mask {
			opacity: 1;
		}
	}

}
